home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / comms / other / amarquee / install_amarquee < prev    next >
Text File  |  1999-05-25  |  24KB  |  550 lines

  1. ; Installation script for the AMarquee system.
  2. ; by Jeremy Friesner.  Miami support by Fredrik Rambris.
  3. ; Updated for v49 by Håkan Parting
  4.  
  5. (transcript "On installing AMarquee...")
  6.  
  7. ;Take a guess at which stack is installed...
  8. (set DefaultSys 1)  ; default to Miami...
  9. (if (= (run "assign inet: EXISTS" (safe)) 0) (set DefaultSys 2))  ; or Inet225 if assign is there
  10. (if (= (run "assign AmiTCP: EXISTS" (safe)) 0) (set DefaultSys 0))  ; or AmiTCP if assign is there
  11.  
  12. (set tcpsys
  13.   (askchoice
  14.   (prompt "Which TCP software do you wish to use AMarqueed with?")
  15.   (help @askdir-help)
  16.   (default DefaultSys)
  17.   (choices
  18.     "AmiTCP"
  19.     "Miami"
  20.     "Inet225"
  21.     "Other"
  22.     )
  23.   )
  24. )
  25.  
  26. (set DaemonFileName "AMarqueed")         ; default
  27. (set LibraryFileName"amarquee.library")  ; default
  28. (set tcpname "(Unknown)")                ; default
  29. (set dbDir "")                           ; default
  30.  
  31. (select tcpsys
  32.   (                              ; for AmiTCP
  33.    (set servdir "AmiTCP:serv")
  34.    (set tcpname "AmiTCP")
  35.    (set dbDir "AmiTCP:db") 
  36.   )
  37.   (
  38.     (set servdir "")             ; for Miami--ask user
  39.     (set tcpname "Miami")
  40.   )
  41.   (                              ; for Inet225
  42.    (set servdir "Inet:serv")
  43.    (set tcpname "Inet225")
  44.    (set dbDir "Inet:db")
  45.    (set DaemonFileName "AMarqueed.inet225")
  46.    (set LibraryFileName "amarquee.library.inet225")
  47.   )
  48.   (set servdir "")               ; for Other--ask user
  49. )
  50.  
  51. (set InstallOpts
  52.   (askoptions
  53.     (
  54.       (prompt "Please indicate which parts of the AMarquee system you wish to install.")
  55.       (help "Which parts of the AMarquee system you should install depend on what you want to do with AMarquee on your system.  Only install the AMarquee server if you wish to use your computer as a host for other Amigas to connect to with their AMarquee programs.  Only install the AMarquee C include files if you wish to write your own AMarquee programs.")
  56.       (choices
  57.         "amarquee.library"
  58.         "AMarqueed server"
  59.         "AMarquee.library C include files"
  60.         "AMarquee.library C++ wrapper file"
  61.         "AMarquee.library PCQ include & .lib files"
  62.         "AMarquee Documentation"
  63.         "AMarquee Example Programs"
  64.         "rexxamarquee.library"
  65.       )
  66.       (default 163)
  67.     )
  68.   )
  69. )
  70.  
  71. (if (BITAND InstallOpts 1)
  72.   (
  73.     ; install amarquee.library
  74.     (copylib (source LibraryFileName) (dest "LIBS:") (newname "amarquee.library"))
  75.   )
  76. )
  77.  
  78. (if (BITAND InstallOpts 128)
  79.   (
  80.     ; install rexxamarquee.library
  81.     (copylib (source "rexxamarquee.library") (dest "LIBS:"))
  82.   )
  83. )
  84.  
  85. (if (BITAND InstallOpts 2)
  86.   (
  87.     ; install AMarqueed server
  88.         
  89.     (if (= tcpsys 3)  ; Other... 
  90.       (message "\nThis Installer script only knows how to install AMarqueed for AmiTCP, Inet225, or Miami.  To install AMarqueed for another system, you will need to do it yourself.  See the AMarquee installation documentation for what needs to be done for Miami, Inet225, or AmiTCP; your TCP stack will likely have similar requirements.  This script can still install the other components of the AMarquee package, though.")
  91.       (
  92.         (if (= servdir "")
  93.           (set servdir   ; Otherwise, Miami
  94.             (askdir
  95.               (prompt "Where do you want to put the AMarquee server executable, AMarqueed?")
  96.               (help @askdir-help)
  97.               (default "Work:")
  98.             )
  99.           )
  100.         )
  101.         
  102.         ; Copy server file
  103.         (copyfiles (source DaemonFileName) (dest servdir) (newname "AMarqueed"))
  104.  
  105.         (set makeResident
  106.           (askbool
  107.             (
  108.               (prompt "\n\nDo you wish to make AMarqueed resident in memory?  This will save memory when multiple connections are active simultaneously.")
  109.               (help "Making a program resident causes AmigaDOS to keep its executable in memory permanently.  When the program is run, instead of loading a new copy of the code into memory, the resident code is shared by the new process.")
  110.               (default 1)
  111.             )
  112.           ) 
  113.         )
  114.  
  115.         (if (= makeResident 1)
  116.           (
  117.             (set InetDPath "AMarqueed")
  118.             (startup "AMarqueed" 
  119.               (prompt ("\n\nOkay to put the line\n\nresident >NIL: %s pure\n\ninto your s:user-startup?" (tackon servdir "AMarqueed")))
  120.               (help "This line in your user-startup will load AMarqueed into memory so that it can be found when needed by inetd.  If you choose not to add this line here, you will need to execute it somewhere else, or inetd will not be able to find AMarqueed and will refuse AMarqueed connections.")
  121.               (command ("resident >NIL: %s PURE" (tackon servdir "AMarqueed") ) )
  122.             )
  123.             (run "resident >NIL: AMarqueed PURE" (safe))  ; in case they don't reboot before trying it out!
  124.           )
  125.           (
  126.             (set InetDPath (tackon servdir "AMarqueed") )
  127.           )
  128.         )
  129.             
  130.         ; modify config files!
  131.         (if (OR (= tcpsys 0) (= tcpsys 2))  ; AmiTCP or Inet225!
  132.           (
  133.             ; modify AmiTCP/Inet225 config files
  134.             (delete "t:edit_text_succeeded")
  135.             (set ARexxRunString (cat "sys:rexxc/rx EditTextFile.rexx " dbDir "/services AMarquee AMarquee^^^^^^^^2957/tcp"))
  136.             (run
  137.               (ARexxRunString)
  138.               (prompt "\n\nTo use AMarqueed with " tcpname ", the line:\n\nAMarquee 2957/tcp\n\nneeds to be present in your " dbDir "/services file.  Do you wish me to update the file?  (Note:  AMarquee will not receive connections if this line is not precisely as shown above!)")
  139.               (help "The inclusion of this line into " dbDir "/services is done by an ARexx script which is smart enough to correctly edit previous installations.  Also it will make a backup (to " dbDir "/services.bak) before writing.")
  140.               (confirm)
  141.             )
  142.             (if (not (exists "t:edit_text_succeeded") )
  143.               (message "The config file editing script (EditTextFile.rexx) did not complete successfully.  You may need to edit your " dbDir "/services file yourself.  Look in the 'Installation' section of the AMarquee docs for instructions.")
  144.             )
  145.             (delete "t:edit_text_succeeded")
  146.             (set userName "root")
  147.             (if (= tcpsys 2) (set userName ""))  ; Inet225 doesn't have the username field
  148.             (set ARexxRunString (cat "sys:rexxc/rx EditTextFile.rexx " dbDir "/inetd.conf AMarquee AMarquee^^^^stream^^^^^^tcp^nowait^" userName "^^^^" InetDPath))
  149.  
  150.             (run
  151.               (ARexxRunString)
  152.               (prompt (cat "\nAlso, the line:\n\nAMarquee stream tcp nowait " userName " " InetDPath "\n\nneeds to be present in your " dbDir "/inetd.conf file.  Do you wish me to update that file?\n(Note:  AMarquee will not receive connections if this line is not precisely as shown above!)"))
  153.               (help "The inclusion of this line into " dbDir "/inetd.conf is done by an ARexx script which is smart enough to correctly edit previous installations.  Also it will make a backup (to " dbDir "/inetd.conf.bak) before writing.")
  154.               (confirm)
  155.             )
  156.  
  157.             (if (not (exists "t:edit_text_succeeded") )
  158.               (message "The config file editing script (EditTextFile.rexx) did not complete successfully.  You may need to edit your " dbDir "/inetd.conf file yourself.  Look in the 'Installation' section of the AMarquee docs for instructions.")
  159.             )
  160.           )
  161.           (
  162.             ; Do config files for Miami: Create the textfile with a pointer to AMarqueed
  163.             (textfile
  164.               (dest "t:dbtemp")
  165.               (append
  166.                 "ADD services AMarquee 2957/tcp\n"
  167.                 ("ADD inetd AMarquee stream tcp nowait root %s\n" InetDPath)
  168.               )
  169.             )
  170.  
  171.             ; Add the lines to envarc:MiamiChangeDB (i.e. don't overwrite! Other programs
  172.             ; may have their lines there too)
  173.             (run "type t:dbtemp >>envarc:MiamiChangeDB")
  174.  
  175.             ; If Miami is running... why not make it read the new settings?
  176.             (run "SYS:Rexxc/RX \"ADDRESS MIAMI.1;changedb\"")
  177.  
  178.             ; Clean up
  179.             (delete "t:dbtemp")
  180.           )
  181.         )
  182.  
  183.         ; set ENV vars if desired
  184.         (set ServerOpts
  185.           (